#include "global_vars.hpp"
#include "analyzer.hpp"
#include "getopt_pp/getopt_pp.h"
#include <iostream>
using namespace GetOpt;

int main(int argc, char* argv[]) 
{
	GetOpt_pp ops(argc, argv);
	
	int poi;
	string arg_file;

	ops >> Option('f', "file", arg_file, "./programs/prog_slice.w");
	if (ops >> OptionPresent("safe")) 	arguments::safe = true;
	if (ops >> OptionPresent("quiet"))	arguments::verbose = false;

	analyzer whittle(arg_file);
	if (ops >> OptionPresent("ast"))	whittle.print_AST("./ast.dot");
	if (ops >> OptionPresent("cfg")) 	whittle.print_CFG("./cfg.dot");

	if (ops >> OptionPresent("RD")) 	whittle.print_RD_analysis();
	if (ops >> Option("slice", poi))	whittle.print_program_slice(poi);

	if (ops >> OptionPresent("LV")) 	whittle.print_LV_analysis();
	if (ops >> OptionPresent("dead"))	whittle.print_dead_code();
	
	if (ops >> OptionPresent("DS")) 	whittle.print_DS_analysis();
	if (ops >> OptionPresent("underflow")) 	whittle.print_underflow();

	if (ops >> OptionPresent("IV")) 	whittle.print_IV_analysis();
	if (ops >> OptionPresent("overunderflow")) 	whittle.print_underflow();

	return 0;
}
